<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="vue.js"></script>
  <style>
    #box{
      width:200px;
      height:200px;
      background-color: rgb(191, 202, 35);
    }
    #box2{
      width:200px;
      height:200px;
      background-color: rgb(13, 196, 150);
    }
    
  </style>
</head>
<body>
  <div id="app">
    <button @click="change">{{ isShow?'消失':'显示' }}</button>
    <div id="box" v-show="isShow">1</div>
    <hr>
    <button @click="change2">{{ isShow2?'消失':'显示' }}</button>
    <div id="box2" v-if="isShow2">2</div>
  
  </div>
  <script>
    let vm = new Vue({
      el:"#app",
      data:{
        isShow:false,
        isShow2:false
      },
      methods:{
        change(){
          this.isShow = !this.isShow;
        },
        change2(){
          this.isShow2 = !this.isShow2;
        }
      }
    })
  </script>
</body>
</html>